/**
 *  ward @ 2019
 *  harrydeep@wardyan.top
 */
package top.wardyan.base.control;

import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;

import top.wardyan.base.config.Const;

/**
 * 
 * @author ward 2019年3月8日
 */
public class WSWT {

	/**
	 * 取得一个Composite
	 * @param parent
	 * @return
	 */
	public static Composite getComposite(Composite parent) {
		return getComposite(parent, null);
	}
	
	public static Composite getComposite(Composite parent, Rectangle bound) {
		Composite rs = new Composite(parent, SWT.NONE);
		if(bound != null)
			rs.setBounds(bound);
		return rs;
	}
	
	public static Label getLabel(Composite parent, Rectangle bound, String label, Font font, Integer align	) {
		Label rs = new Label(parent, SWT.NONE);
		if(bound != null)
			rs.setBounds(bound);
		rs.setText(label);
		if(font != null)
			rs.setFont(font);
		rs.setAlignment(align);
		rs.setBackground(Const.COLOR_BLACK);
		return rs;
	}
	
	
}
